package gov.goias.srh.negocio;

import gov.goias.srh.excessao.InfraExcessao;
import gov.goias.srh.excessao.NegocioExcessao;
import gov.goias.srh.modelo.Cargo;
import gov.goias.srh.persistencia.CargoDAO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(readOnly = true)
public class ManterCargoNG {
	
	@Autowired
	private CargoDAO dao;
	
	
	@Transactional(readOnly = true)
	public void salvar(Cargo cargo) throws NegocioExcessao, InfraExcessao{
		
		if(cargo.getId() == null){
			dao.incluir(cargo);
		}else{
			dao.alterar(cargo);
		}
		
	}
	
}